function init(where)
{
	canvas = document.getElementById("canvas");
	if(!where)
	{
		screen = canvas.getContext("2d");
		initSprites();
		//changeLevel("microban",1);
	}
	else
	{
		layoutPage();
		//layoutLevel();
		showMenu();
		document.addEventListener("keydown",handleInput);
	}
}

function layoutPage()
{
	makeInstructions(document.getElementById("main"));
	makeControls(document.getElementById("main"));
	canvas.width = canvasWidth();
	canvas.height = 600;
	screen.width  = parseInt(canvas.width);
	screen.height  = parseInt(canvas.height);
}

function changeLevel(episode,levelNumber)
{
	game.episode = episode;
	game.levelNumber = levelNumber;
	if(game[episode] === undefined)
		getEpisode(episode);
	game.currentLevel = copyLevel(game[episode][levelNumber - 1]);
	game.orientation = 1;
	moveList = [];
	moveList.push(copyLevel(game.currentLevel));
	moveListIndex = 0;
	layoutLevel();
}
